using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IGCal.GA;
using IGCal.Windows.DB;

namespace Calcio
{
    public partial class frmAllenamenti : Form
    {
        public frmAllenamenti()
        {
            InitializeComponent();
        }
        public void Start()
        {
            this.Show();
            this.MdiParent = Globals.MDIForm;

            string SQL = string.Empty;

            SQL += "Select ";
            SQL += "    * ";
            SQL += "From ";
            SQL += "    Giocatori ";
            SQL += "Where ";
            SQL += "    Giocatori.Stagione = '2007/2008'" ;

           

           DataTable dt = Globals.Connection.GetDataTable(SQL);
           DataTable visualizza = new DataTable();
           DataColumn myDataColumn;
            
            this.dataGridView1.Columns.Add("Data", "Data");
            myDataColumn = new DataColumn();
            myDataColumn.ColumnName = "Data";
            myDataColumn.DataType = Type.GetType("System.DateTime");
            visualizza.Columns.Add(myDataColumn);
            
            foreach (DataRow dr in dt.Rows)
            {
              
                myDataColumn = new DataColumn();
                myDataColumn.ColumnName = dr["Cognome"].ToString();
                myDataColumn.AllowDBNull = true;
                myDataColumn.Unique = true;
                visualizza.Columns.Add(myDataColumn);
            }

            this.dataGridView1.DataSource = visualizza;
            
            /*  SQL = string.Empty;

            SQL += "Select ";
            SQL += "    * ";
            SQL += "From ";
            SQL += "    Allenamento ";

            dt = Globals.Connection.GetDataTable(SQL);
            foreach (DataRow dr in dt.Rows)
            {
                this.dataGridView1.Rows.Add("dsds");

            }*/
        
        
        
        
        
        }

       
    
    
    
    
    
    }
}